package com.tiancheng.trade.merchant.controller.api;

import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.commom.web.model.OrgBusinessDTO;
import com.tiancheng.trade.commom.web.model.request.QueryOrgBusinessReq;
import com.tiancheng.trade.merchant.service.IOrgBusinessService;
import com.tiancheng.trade.merchant.vo.merchant.GetMerchantVO;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName OrgBusinessApiController
 * @Description TODO
 * @Author kellen
 * @Date 2024/11/24 22:08
 */
@RestController
@RequestMapping("/api/orgBusiness")
@AllArgsConstructor
public class OrgBusinessApiController {

    private final IOrgBusinessService orgBusinessService;
    /**
     * 根据应用id查询机构业务配置信息
     *
     * @param queryOrgBusinessReq {@link QueryOrgBusinessReq} 应用id
     * @return {@link Result}<{@link List}<{@link GetMerchantVO}>>
     */
    @PostMapping("/queryOrgBusiness")
    public Result<List<OrgBusinessDTO>> getMerchantsByName(@RequestBody QueryOrgBusinessReq queryOrgBusinessReq) {
        return Result.success(orgBusinessService.getByClientId(queryOrgBusinessReq.getClientId(),queryOrgBusinessReq.getTermNo()));
    }

}
